<html>
<head><meta charset="utf-8"><title>Allow foreign exceptions to unwind through Rust code #65646 · project-ffi-unwind · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/index.html">project-ffi-unwind</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html">Allow foreign exceptions to unwind through Rust code #65646</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="178695165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/178695165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#178695165">(Oct 21 2019 at 20:28)</a>:</h4>
<p>So <span class="user-mention" data-user-id="143274">@Amanieu</span> has a PR that seems quite relevant to this working group =) I'm behind on our Zulip channels right now but I wanted to make sure we discussed it. At least based on the "main description" it sounds pretty great!</p>



<a name="178695385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/178695385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#178695385">(Oct 21 2019 at 20:30)</a>:</h4>
<p>Description:</p>
<blockquote>
<p>This PR allows C++ exceptions (and any other exceptions) to safely unwind through Rust code. In particular:<br>
- Drop code will be executed as the exception unwinds through the stack, as with a Rust panic.<br>
- <code>catch_unwind</code> will <em>not</em> catch the exception, instead the exception will silently continue unwinding past it.</p>
<p>Incidentally, Rust panics can unwind just fine through C++ code as long as you mark the function with <code>#[unwind(allowed)]</code>. I've added a test for it to be sure.</p>
<p>I haven't updated any of the documentation, so officially unwinding through FFI is still UB. However this is a step towards making it well-defined.</p>
</blockquote>



<a name="178695419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/178695419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#178695419">(Oct 21 2019 at 20:31)</a>:</h4>
<p>Yes, Centril tagged me! I'll check it out. I meant to read the two RFC drafts yesterday but did not finish yet, unfortunately.</p>



<a name="178695458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/178695458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#178695458">(Oct 21 2019 at 20:31)</a>:</h4>
<p>OK :)</p>



<a name="178712681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/178712681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#178712681">(Oct 22 2019 at 00:33)</a>:</h4>
<p>Oh I didn't realize there was a WG for this. I only looked into this because <span class="user-mention" data-user-id="132920">@gnzlbg</span> mentioned it to me.</p>



<a name="178712798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/178712798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#178712798">(Oct 22 2019 at 00:35)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> Welcome! We plan to announce our existence...soon...ish.</p>



<a name="179229620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179229620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179229620">(Oct 28 2019 at 13:22)</a>:</h4>
<p>I'm done with the PR. I've updated the description with details of the new behavior, so you can use it as a base for what to allow/disallow in this WG.</p>



<a name="179229626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179229626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179229626">(Oct 28 2019 at 13:22)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/65646" target="_blank" title="https://github.com/rust-lang/rust/pull/65646">https://github.com/rust-lang/rust/pull/65646</a></p>



<a name="179230844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179230844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179230844">(Oct 28 2019 at 13:36)</a>:</h4>
<p>I think that there is quorum that allowing foreign exceptions to unwind through Rust code at some point would be ok</p>



<a name="179230907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179230907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179230907">(Oct 28 2019 at 13:36)</a>:</h4>
<p>The main controversy is whether one should be able to catch them or not from Rust <span class="user-mention" data-user-id="143274">@Amanieu</span></p>



<a name="179230945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179230945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179230945">(Oct 28 2019 at 13:36)</a>:</h4>
<p>That is, whether it should be possible to catch them at all, and if so, whether <code>catch_unwind</code> or something else</p>



<a name="179230955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179230955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179230955">(Oct 28 2019 at 13:36)</a>:</h4>
<p>The main issue is that the signature of <code>catch_unwind</code> really isn't suited for returning a caught foreign exception.</p>



<a name="179230999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179230999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179230999">(Oct 28 2019 at 13:37)</a>:</h4>
<p>There is also the implementation issue of how should <code>catch_unwind</code> (or similar) deal with forced exceptions, etc.</p>



<a name="179231020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231020">(Oct 28 2019 at 13:37)</a>:</h4>
<p>but yes, the signature is a big problem</p>



<a name="179231028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231028">(Oct 28 2019 at 13:38)</a>:</h4>
<p>Or longjmp exceptions on Windows.</p>



<a name="179231068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231068">(Oct 28 2019 at 13:38)</a>:</h4>
<p>yes</p>



<a name="179231096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231096">(Oct 28 2019 at 13:38)</a>:</h4>
<p>those aren't technically forced, but handling longjmp on windows differently would mean that longjmp behaves differently across platforms</p>



<a name="179231114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231114">(Oct 28 2019 at 13:38)</a>:</h4>
<p>and a lot of code might want to rely on that not happening, but the truth is that <code>longjmp</code> does behave very differently across platforms</p>



<a name="179231144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231144">(Oct 28 2019 at 13:39)</a>:</h4>
<p>It already behaves differently across platforms: it only runs destructors on MSVC, not on MinGW or any non-Windows platform.</p>



<a name="179231154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231154">(Oct 28 2019 at 13:39)</a>:</h4>
<p>yes</p>



<a name="179231179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231179">(Oct 28 2019 at 13:39)</a>:</h4>
<p>My current opinion is that <code>catch_unwind</code> should ignore foreign exceptions always</p>



<a name="179231192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231192">(Oct 28 2019 at 13:39)</a>:</h4>
<p>and If we want to add support for catching foreign exceptions, that should be a different API</p>



<a name="179231193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231193">(Oct 28 2019 at 13:39)</a>:</h4>
<p>IMO we should just do the same as C++ and say longjmp is UB if it unwinds through frames with destructors.</p>



<a name="179231203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231203">(Oct 28 2019 at 13:40)</a>:</h4>
<p>Yes I agree.</p>



<a name="179231294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231294">(Oct 28 2019 at 13:40)</a>:</h4>
<p>the thing is that while C++ as a language says its UB, the implementations of C++ sometimes say "that is actually guaranteed to do X" (MSVC documents that longjmp runs destructors, and that's a guarantee there, so code for that platform can rely on that)</p>



<a name="179231353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231353">(Oct 28 2019 at 13:41)</a>:</h4>
<p>Actually MSVC documents that longjmp <em>sometimes</em> runs desctructors, depending on compiler options. And it has a big warning box saying that relying on this is nonportable.</p>



<a name="179231369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231369">(Oct 28 2019 at 13:41)</a>:</h4>
<p>It also depends on <code>noexcept</code>, etc.</p>



<a name="179231447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231447">(Oct 28 2019 at 13:42)</a>:</h4>
<p>MSVC documents that destructors of <code>noexcept</code> functions might or might not be run depending on the function being inlined</p>



<a name="179231465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231465">(Oct 28 2019 at 13:42)</a>:</h4>
<p>but there is a long shot from that to "UB"</p>



<a name="179231500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231500">(Oct 28 2019 at 13:42)</a>:</h4>
<p>I prefer to provide reasonables guarantees for the two types of unwinding that we have in general, the one that runs destructors, and the one that does not</p>



<a name="179231511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231511">(Oct 28 2019 at 13:43)</a>:</h4>
<p>and then what longjmp does on platform X depends on how platform X implements longjmp</p>



<a name="179231525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231525">(Oct 28 2019 at 13:43)</a>:</h4>
<p>but the language doesn't have to say anything about that</p>



<a name="179231544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/Allow%20foreign%20exceptions%20to%20unwind%20through%20Rust%20code%20%2365646/near/179231544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/Allow.20foreign.20exceptions.20to.20unwind.20through.20Rust.20code.20.2365646.html#179231544">(Oct 28 2019 at 13:43)</a>:</h4>
<p>(we want to probably document what each platform does)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>